@extends('layout.page')
@section('title','渠道 - 成交明细')

@section('static-page')
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>渠道 <small>成交明细</small></h5>
            </div>
            <div class="ibox-content">
                <form class="form-horizontal" method="get" action="/ceb/channels/deals">

                    <input type="text" name="channel_code" class="hidden" value="{{$channel}}">
                    <input type="text" name="date" class="hidden" value="{{$date}}">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">是否首投：</label>
                        <div class="col-sm-4">
                            <select class="form-control" name="is_first">
                                <option value="0" @if($is_first == 0) selected @endif>全部</option>
                                <option value="1" @if($is_first == 1) selected @endif>是</option>
                                <option value="2" @if($is_first == 2) selected @endif>否</option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <select class="form-control" name="duration">
                                @foreach($duration_cfg_list as $duration_cfg)
                                    <option value="{{$duration_cfg['id']}}" @if($duration_cfg['id'] == $duration) selected @endif>{{$duration_cfg['name']}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-sm-2"><input class="btn btn-success" type="submit" value="筛选"></div>
                    </div>
                </form>
                <table class="table table-bordered text-center">
                    <thead class="text-center">
                    <tr>
                        <th>编号</th>
                        <th>手机号</th>
                        <th>投资标的名称</th>
                        <th>期限</th>
                        <th>投资时间</th>
                        <th>是否首投</th>
                        <th>使用现金券</th>
                        <th>发放红包</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $investment)
                        <tr>
                            <td>{{$investment['id']}}</td>
                            <td>{{$investment['phone']}}</td>
                            <td>{{$investment['borrow_info']['borrow_name']}}</td>
                            <td>{{$investment['borrow_info']['borrow_duration']}}天</td>
                            <td>{{date('Y-m-d H:i:s',$investment['add_time'])}}</td>
                            <td>{{empty($investment['is_first']) ? '否' : '是'}}</td>
                            <td>@if(!empty($investment['ticket'])) {{$investment['ticket']}} @endif</td>
                            <td></td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                @include('wiget.pager',[
                    'page' => $page,
                    'page_size' => $size,
                    'count' => $count,
                    'show_count' => 10,
                    'path' => url('/ceb/channels/deals?channel_code=' . $channel . '&date=' . $date  . '&is_first=' . $is_first . '&duration=' . $duration)
                ])
            </div>
        </div>
    </div>
@endsection
